package com.zcc.thread;

public class HelloThread3 implements Runnable {
    private int ticketCount = 10;
    @Override
    public void run() {
        while (ticketCount > 0) {
            System.out.println(Thread.currentThread().getName() + "拿到了第" + ticketCount-- + "票");
        }
    }

    public static void main(String[] args) {
        Thread t1 = new Thread(new HelloThread3(),"小王");
        Thread t2 = new Thread(new HelloThread3(),"小红");
        Thread t3 = new Thread(new HelloThread3(),"小明");
        t1.start();
        t2.start();
        t3.start();
    }
}
